package de.fhkoeln.avs.strategypattern;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 *
 * @author Markus and Muhammed
 */
public class Context {
    
    private static Logger logger = LoggerFactory.getLogger(Context.class);
    
    private ISearchStrategy searchStrategy = null;
    private IBuildStrategy buildGraphStrategy = null;

    
    public void search(String startTerm, String endTerm) {
        if(this.searchStrategy != null) {
            this.searchStrategy.search(startTerm, endTerm);
        } else {
            logger.info("No search strategy is set!");
        }
    }

    public void buildGraph() {
        if(this.buildGraphStrategy != null) {
            this.buildGraphStrategy.search();
        } else {
            logger.info("No graph build strategy is set!");
        }
    }
    
    /**
     * @return the searchStrategy
     */
    public ISearchStrategy getSearchStrategy() {
        return searchStrategy;
    }

    /**
     * @param searchStrategy the searchStrategy to set
     */
    public void setSearchStrategy(ISearchStrategy searchStrategy) {
        this.searchStrategy = searchStrategy;
    }

    /**
     * @return the buildGraphStrategy
     */
    public IBuildStrategy getBuildGraphStrategy() {
        return buildGraphStrategy;
    }

    /**
     * @param buildGraphStrategy the buildGraphStrategy to set
     */
    public void setBuildGraphStrategy(IBuildStrategy buildGraphStrategy) {
        this.buildGraphStrategy = buildGraphStrategy;
    }

}
